<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // try {
        //     let obj = undefined
        //     console.log(obj.name);
        // } catch (err) {
        //     console.log(err);
        // }
        // console.log('林嘉辉');

        function newPromise(name) {
            return new Promise((resolve, reject) => {
                setTimeout(() => {
                    if (1 > 0) {
                        resolve(name + '文件读取成功');
                    } else {
                        reject('文件读取失败');
                    }
                }, 1000)
            })
        }
        async function read() {
            let res1 = await newPromise('a')
            console.log(res1);

            let res2 = await newPromise('b')
            console.log(res2);

            let res3 = await newPromise('c')
            console.log(res3);
        }
        read()
    </script>

</body>

</html>